<?php
include("../../db_connection.php");
session_start();
// Check for a cookie, if none go to login page
if (!isset($_COOKIE['session_id']))
{
    header('Location: login.php?refer='. urlencode(getenv('REQUEST_URI')));
}

// Try to find a match in the database
$guid = $_COOKIE['session_id'];

$query = "SELECT uid FROM susers WHERE guid = '$guid' and root =1";
$result = mysql_query($query, $user_con);

if (!mysql_num_rows($result))
{
    // No match for guid
	header('Location: login.php?refer='. urlencode(getenv('REQUEST_URI')));
}
?>